<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglib.jsp"%>
<!doctype html>
<html class="x-border-box x-strict x-viewport">
<head>
<%@ include file="/common/head-system.jsp"%>
<script type="text/javascript">
	function add2mapping(){
		var f = jQuery("#mainForm");
		f.attr("action", "addTable2mapping.do");
		f.submit();
	}
	function selectAll(checkbox, classSuffix){
		jQuery(".select-all-"+classSuffix).attr("checked", checkbox.checked);
	}
	jQuery(function(){
		openMenu(1, 1);
		jQuery("#main_title").html("代码生成 - 集合 - 表结构");
	});
</script>
<title></title>
</head>
<body class="x-body x-reset x-border-layout-ct x-container">
	<%@ include file="/common/before-body-system.jsp"%>
	<form action="list.do" method="post" id="mainForm">
		<!-- query form -->
		<ext:panel head="查询条件">
			<table>
				<tr>
					<td width="400"><ext:formField labelname="表名"
							fieldname="entityQuery.tableName">
							<s:textfield name="entityQuery.tableName"
								cssClass="x-form-field x-form-text" cssStyle="width: 100%;" />
						</ext:formField></td>
					<td width="400"><ext:formField labelname="备注"
							fieldname="entityQuery.comments">
							<s:textfield name="entityQuery.comments"
								cssClass="x-form-field x-form-text" cssStyle="width: 100%;" />
						</ext:formField></td>
				</tr>
			</table>
		</ext:panel>
		<!-- operation -->
		<div
			style="width: 100%; height: 34px; text-align: right; padding: 3px 0px;">
			<ext:button name="查询" width="50"
				onclick="jQuery('#mainForm').submit();" />
		</div>
		<!-- data grid -->
		<ext:panel head="列表">
			<div class="my-grid">
			<table cellpadding="0" border="0" cellspace="0" width="100%">
				<tr>
					<td width="30"><ext:gridHeadCell>
							序号
						</ext:gridHeadCell>
					</td>
					<td width="50"><ext:gridHeadCell align="center">
							<input type="checkbox" onclick="selectAll(this, 'tableNames')" />选择
						</ext:gridHeadCell></td>
					<td><ext:gridHeadCell>
							名称
						</ext:gridHeadCell>
					</td>
					<td><ext:gridHeadCell name="tableName" page="page"
							sortable="true">
							表名
						</ext:gridHeadCell>
					</td>
					<td><ext:gridHeadCell>
							备注
						</ext:gridHeadCell>
					</td>
					<td width="50"><ext:gridHeadCell align="center">
							操作
						</ext:gridHeadCell>
					</td>
				</tr>
				<s:iterator value="page.result" id="vo" status="s">
					<s:if test="#s.count%2 == 1">
						<s:set name="rc" value="''" />
					</s:if>
					<s:else>
						<s:set name="rc" value="' x-grid-row-alt'" />
					</s:else>
					<tr class="x-grid-row<s:property value='rc' />">
						<td style="padding-left: 0px;"
							class=" x-grid-cell x-grid-cell-special x-grid-cell-first"><div
								style="text-align: right; font-weight: bolder;"
								class="x-grid-cell-inner">
								<s:property value="#s.count" />
							</div></td>
						<td class=" x-grid-cell"><div style="text-align: left;"
								class="x-grid-cell-inner">
								<input type="checkbox" name="tableNames"
									class="select-all-tableNames"
									value="<s:property value='#vo.tableName'/>" />
							</div>
						</td>
						<td class=" x-grid-cell"><div style="text-align: left; width: 150px;"
								class="x-grid-cell-inner">
								<span class="show-title"><s:property value="#vo.nameShow" />
								</span>
							</div>
						</td>
						<td class=" x-grid-cell"><div style="text-align: left;"
								class="x-grid-cell-inner">
								<s:property value="#vo.tableName" />
							</div>
						</td>
						<td class=" x-grid-cell"><div style="text-align: left; width: 150px;"
								class="x-grid-cell-inner">
								<s:property
										value="#vo.commentText" />
							</div>
						</td>
						<td class=" x-grid-cell x-grid-cell-last"><div
								 style="text-align: left;" class="x-grid-cell-inner">
								<s:url id="u"
									value='%{"/mapping/" + mapping.nameText + "/tables/" + #vo.nameText + "/list.do"}' includeParams="none" />
								<s:a href="%{u}">
								数据
								</s:a>
							</div>
						</td>
					</tr>
				</s:iterator>
			</table>
			</div>
			<ext:page page="page" />
		</ext:panel>
		<br />
		<!-- input form -->
		<s:hidden name="mapping.nameText" />
		<ext:panel head="设置默认值">
			<ext:formField labelname="包路径" fieldname="defaultEntity.packageText">
				<s:textfield name="defaultEntity.packageText"
					cssClass="x-form-field x-form-text" cssStyle="width: 100%;" />
			</ext:formField>
			<ext:formField labelname="是否有表前缀" fieldname="defaultEntity.hasPrefix">
				<s:textfield name="defaultEntity.hasPrefix"
					cssClass="x-form-field x-form-text" cssStyle="width: 100%;" />
			</ext:formField>
			<ext:formField labelname="表前缀" fieldname="defaultEntity.prefixText">
				<s:textfield name="defaultEntity.prefixText"
					cssClass="x-form-field x-form-text" cssStyle="width: 100%;" />
			</ext:formField>
			<ext:formField labelname="是否有效" fieldname="defaultEntity.isWork">
				<s:textfield name="defaultEntity.isWork"
					cssClass="x-form-field x-form-text" cssStyle="width: 100%;" />
			</ext:formField>
			<ext:formField labelname="集合" fieldname="mapping.id">
				<s:select name="mapping.id" list="mappingList" listKey="id"
					listValue="nameText" />
			</ext:formField>
		</ext:panel>
		<div
			style="width: 100%; height: 34px; text-align: right; padding: 3px 0px;">
			<ext:button name="加入集合" width="80" onclick="add2mapping();" />
		</div>
	</form>
	<%@ include file="/common/after-body-system.jsp"%>
</body>
</html>
